Skip to content

Conversation

@aamirsahmad
Copy link

@aamirsahmad aamirsahmad commented Oct 31, 2024

  • Update class methods (perform, call, to_proc) to explicitly handle keyword arguments
  • Add **kwargs parameter to handle keyword arguments separately from positional args
  • Fix deprecation warnings related to keyword argument handling
  • Maintain backward compatibility while preparing for Ruby 3.0

This change addresses the Ruby 2.7 deprecation warning: "Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call"

Testing

@aamirsahmad aamirsahmad force-pushed the aamir/WIN-2123-address-deprecation-warning-active-operation branch from 369e08a to 3661bfc Compare November 1, 2024 16:35
Comment on lines +33 to +34
when :keyreq, :key
input name, type: :keyword, required: (type == :keyreq)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this change and why was it required?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously the API was method(*args), now it supports both method(*args, **kwargs) so this is to ensure positional arg is required and kwargs aren't

arguments = args.shift(arity)
attributes = args.last.kind_of?(Hash) ? args.pop : {}
attributes = if args.last.is_a?(Hash)
args.pop.transform_keys(&:to_sym)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to do symbols?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think some test cases were failing and this fixed them

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants